import { createApp } from 'vue';
import App from './App.vue';
import { ElDatePicker, ElSelect, ElOption } from 'element-plus'; // 按需引入 Element Plus 组件
import * as ElementPlusIconsVue from '@element-plus/icons-vue';
import router from './router/index';
import { createPinia } from 'pinia';
import i18n from './i18n'
import 'element-plus/dist/index.css'; // 使用新的样式路径
import piniaPluginPersistence from 'pinia-plugin-persistedstate';
import vue3SeamlessScroll from "vue3-seamless-scroll";
const app = createApp(App);

// 注册 ElementPlus 组件
app.component('ElDatePicker', ElDatePicker); // 注册 el-date-picker
app.component('ElSelect', ElSelect); // 注册 el-select
app.component('ElOption', ElOption); // 注册 el-option

// 注册 ElementPlus 图标组件
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
  app.component(key, component);
}

// 注册路由和 Pinia
app.use(router);
const pinia = createPinia();
pinia.use(piniaPluginPersistence)
app.use(pinia);
app.use(i18n);
app.use(vue3SeamlessScroll);
// 挂载应用
app.mount('#app');
